NonZeroInt

@SinceKotoolsTypes(version = "1.1")
value class NonZeroInt constructor(val value: Int) : Comparable<NonZeroInt>

Represents integers that don't equal 0.

Constructors

Link copied to clipboard
fun NonZeroInt(value: Int)

Returns the value as a non-zero int, or throws an IllegalArgumentException if the value equals 0.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
@SinceKotoolsTypes(version = "1.3")
infix operator fun compareTo(other: Int): Int
@SinceKotoolsTypes(version = "1.3")
infix operator fun compareTo(other: NegativeInt): Int
open infix operator override fun compareTo(other: NonZeroInt): Int
@SinceKotoolsTypes(version = "1.3")
infix operator fun compareTo(other: PositiveInt): Int
@SinceKotoolsTypes(version = "1.3")
infix operator fun compareTo(other: StrictlyNegativeInt): Int
@SinceKotoolsTypes(version = "1.3")
infix operator fun compareTo(other: StrictlyPositiveInt): Int

Compares this value with the other value for order. Returns 0 if this value equals the other value, a negative number if this value is less than the other value, or a positive number if this value is greater than the other value.

Link copied to clipboard
operator fun dec(): NonZeroInt

Returns this value decremented by 1. If this value equals 1, it returns -1 instead. If this value is the minimum, it returns the maximum value instead.

Link copied to clipboard
infix operator fun div(other: Int): Int
infix operator fun div(other: NegativeInt): Int
infix operator fun div(other: PositiveInt): Int

Divides this value by the other value, truncating the result to an integer that is closer to 0. Throws an ArithmeticException if the other value equals 0.

infix operator fun div(other: NonZeroInt): Int
infix operator fun div(other: StrictlyNegativeInt): Int
infix operator fun div(other: StrictlyPositiveInt): Int

Divides this value by the other value, truncating the result to an integer that is closer to 0.

Link copied to clipboard
operator fun inc(): NonZeroInt

Returns this value incremented by 1. If this value equals -1, it returns 1 instead. If this value is the maximum, it returns the minimum value instead.

Link copied to clipboard
infix operator fun minus(other: Int): Int
infix operator fun minus(other: NegativeInt): Int
infix operator fun minus(other: NonZeroInt): Int
infix operator fun minus(other: PositiveInt): Int
infix operator fun minus(other: StrictlyNegativeInt): Int
infix operator fun minus(other: StrictlyPositiveInt): Int

Subtracts the other value from this value.

Link copied to clipboard
infix operator fun plus(other: Int): Int
infix operator fun plus(other: NegativeInt): Int
infix operator fun plus(other: NonZeroInt): Int
infix operator fun plus(other: PositiveInt): Int
infix operator fun plus(other: StrictlyNegativeInt): Int
infix operator fun plus(other: StrictlyPositiveInt): Int

Adds the other value to this value.

Link copied to clipboard
infix operator fun times(other: Int): Int
infix operator fun times(other: NegativeInt): Int
infix operator fun times(other: NonZeroInt): NonZeroInt
infix operator fun times(other: PositiveInt): Int
infix operator fun times(other: StrictlyNegativeInt): NonZeroInt
infix operator fun times(other: StrictlyPositiveInt): NonZeroInt

Multiplies this value by the other value.

Link copied to clipboard

Returns this value as a negative int, or throws an IllegalArgumentException if this value is strictly positive.

Link copied to clipboard

Returns this value as a negative int, or returns null if this value is strictly positive.

Link copied to clipboard
@SinceKotoolsTypes(version = "1.2")
fun toNotBlankString(): NotBlankString

Returns the string representation of this value as a not blank string.

Link copied to clipboard

Returns this value as a positive int, or throws an IllegalArgumentException if this value is strictly negative.

Link copied to clipboard

Returns this value as a positive int, or returns null if this value is strictly negative.

Link copied to clipboard

Returns this value as a strictly negative int, or throws an IllegalArgumentException if this value is strictly positive.

Link copied to clipboard

Returns this value as a strictly negative int, or returns null if this value is strictly positive.

Link copied to clipboard

Returns this value as a strictly positive int, or throws an IllegalArgumentException if this value is strictly negative.

Link copied to clipboard

Returns this value as a strictly positive int, or returns null if this value is strictly negative.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
operator fun unaryMinus(): NonZeroInt

Returns the negative of this value.

Link copied to clipboard
operator fun unaryPlus(): NonZeroInt

Returns this value.

Properties

Link copied to clipboard
val value: Int